﻿-var photoFile = ViewData.ContainsKey("photofile") ? ViewData["photofile"] as DataFile : null
-var infoFile = ViewData.ContainsKey("infofile") ? ViewData["infofile"] as DataFile : null
%table{width="48%",cellspacing="3"}
  %tr
    %td{width="48%"}
      %label
        %img.icon16{src="img/attach.gif"}
        Страница с фотографией:
    %td{width="51%"}
      -var isPhotoFileExists = (photoFile != null)
      #photofileholder{class=(!isPhotoFileExists) ? "hidden" : ""}
        -if(isPhotoFileExists)
          %li.photofile{id=string.Format("file{0}",photoFile.Id)}
            %img.icon16{src=string.Format("img/mime/{0}_16.gif",System.IO.Path.GetExtension(photoFile.Name).TrimStart('.'))}
            %a.noul{href=string.Format("person.ivp/viewfile/{0}",photoFile.Id)}=photoFile.Name
            -if (!readOnly)
              %a.noul{href="#",onclick=string.Format("return removeFile({0}, 'photofile');",photoFile.Id)}
                %img{src="img/trash.gif",title="Удалить"}
      -if (!isPhotoFileExists&& readOnly)
        ="отсутствует"
      #inputphotofileholder{class=(isPhotoFileExists || readOnly) ? "hidden" : ""}
        %input{size="30" type="file" id="photofile" name="photofile"}
.spacer10
%table{width="48%",cellspacing="3"}
  %tr
    %td{width="48%"}
      %label
        %img.icon16{src="img/attach.gif"}
        Страница с пропиской:
    %td{width="51%"}
      -var isInfoFileExists = (infoFile != null)
      #infofileholder{class=(!isInfoFileExists) ? "hidden" : ""}
        -if(isInfoFileExists)
          %li.infofile{id=string.Format("file{0}",infoFile.Id)}
            %img.icon16{src=string.Format("img/mime/{0}_16.gif",System.IO.Path.GetExtension(infoFile.Name).TrimStart('.'))}
            %a.noul{href=string.Format("person.ivp/viewfile/{0}",infoFile.Id)}=infoFile.Name
            -if (!readOnly)
              %a.noul{href="#",onclick=string.Format("return removeFile({0}, 'infofile');",infoFile.Id)}
                %img{src="img/trash.gif",title="Удалить"}
      -if (!isInfoFileExists && readOnly)
        ="отсутствует"
      #inputinfofileholder{class=(isInfoFileExists || readOnly) ? "hidden" : ""}
        %input{size="30" type="file" id="infofile" name="infofile"}
.spacer10